package BookMethods;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class ReturnMethod implements BookMethods{

    @Override
    public void method(BookList booklist) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("输入要归还的书的名字");
        String bookName = scanner.nextLine();


        for (int i = 0; i < booklist.getUsedSize(); i++) {
            Book book = booklist.getBook()[i];
            if (bookName.equals(book.getBookName())) {
                book.setBorrow(false);
                System.out.println("归还成功");
                return;

            }
        }
        System.out.println("找不到此书");
    }

}
